﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using S4Store.Domain.Report;
using S4Store.Domain;

namespace S4Store.Models.Inventory
{
    public class AgedIndexModel : BaseReportModel
    {
        public AgedIndexModel()
        {
            Reports = new List<CarModelSaleReport>();
        }
        public List<CarModelSaleReport> Reports { get; set; }

        public List<CarBrand> CarBrands
        {
            get
            {
                return Reports.GroupBy(t => t.CarModel.Brand).Select(t => t.Key).Distinct().ToList();
            }
        }

        public List<CarModelSaleReport> GetCarModelReports(CarBrand brand)
        {
            return Reports.Where(t => t.CarModel.BrandId == brand.Id).ToList();
        }
    }
}